package com.ijunfu.spring.applicationContext._01_autowired.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

/**
 *
 * @Title  : 
 * @Author : ijunfu <ijunfu@163.com>
 * @Date   : 2023/11/11 10:26
 * @Version: 1.0
 * @Motto  : 世界很大 世界很小
 *
 */
@Service
public class UserService {

    private RoleService roleService;

    @Autowired
    private ApplicationContext applicationContext;

    public void print(){
        roleService = applicationContext.getBean("roleService", RoleService.class);
        System.out.println(roleService);
    }
}
